<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<form name="form" accept="aaa" onsubmit="return validateForm()" method="post">
			<input type="text" name="userName"/>
			<input type="submit" value="提交"/>
		</form>
		
		<script>
			function validateForm(){
				var userName = document.forms["form"]["userName"].value;
				if(userName=="" || userName==null){
					return false;
				}
			}
		</script>
	</body>
</html>